import { FMVCS } from "../../fgui/fmvc/FMVCS";
import TipsData from "./TipsData";
import { GlobalEvent } from "../global/Global";
import Manager from "../../manager/Manager";
import { ConstDefine } from "../common/ConstDefine";
import TipsView from "./TipsView";

export default class TipsCtrl extends FMVCS.FCtrl {
    /** 数据实体 */
    static data: TipsData = null;

    constructor() {
        super();
        TipsCtrl.data = new TipsData();
    }

    /** 事件监听注册 */
    rigisterEventListener(){
        this.on(GlobalEvent.UIListenID.UI_ShowTips, this.onOpenView, this);
    }

    onOpenView(text: string = ``, callBack: Function = () => {}){
        TipsCtrl.data.vo.text = text;
        TipsCtrl.data.vo.callBack = callBack;
        Manager.fui.open(ConstDefine.UI.TipsView, TipsView);
    }
}
